﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using UFSSWebApp.UFSSservicereference;

namespace UFSSWebApp
{
    public partial class updateinfo : System.Web.UI.Page
    {
        UFSSservicereference.UserCreds uc = new UFSSservicereference.UserCreds();
        UFSSservicereference.UFSSserviceSoapClient ussc = new UFSSservicereference.UFSSserviceSoapClient();
        ArrayOfString info = new ArrayOfString();

        protected void Page_Load(object sender, EventArgs e)
        {
            uc = (UFSSservicereference.UserCreds)Session["usercreds"];
            refresh();
        }

        private void refresh()
        {
            info.AddRange(ussc.getUserInfo(uc));
            txtFname.Text = info[1];
            txtLname.Text = info[2];
            txtEmail1.Text = info[3].ToString();
            txtEmail2.Text = info[3].ToString();
        }

        protected void btnReset_Click(object sender, EventArgs e)
        {
            refresh();
        }

        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                ussc.updateUser(uc, txtFname.Text, txtLname.Text, txtEmail1.Text);
            }
            catch
            {
            }
        }
    }
}